<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="support.*, java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Provide degrees - Choose location</title>
</head>
<body>
<center>
Please choose the location of your university:
</center>

<% 	String path = config.getServletContext().getRealPath("universities.txt");
	support s = new support();
	Vector universities = s.getUniversities(path);
	
	Integer columncounter = 0;
	out.println("<br>");
	out.println("<table width=\"600\" border=\"2\" cellpadding=\"2\" cellspacing=\"2\" align=\"center\">");
	for (int i=0; i<universities.size(); i++){
	      //each entry in the universities vector is a tuple with the first entry being the country/state
	      //and the second entry being a vector of the universities as String's
		columncounter += 1;
		if(columncounter == 1)
			out.println("<tr>");
		
		Vector tuple = (Vector)universities.get(i);
		String state = (String)tuple.get(0);
		out.println("<td>" + "<a href=\"http://localhost:8080/GraduateSchoolApp/provideDegreesChooseUniversities.jsp?stateIndex=" + i + "\">" + state + "</a>" + "</td>");
		
		if (columncounter >= 3) {
			out.println("</tr>");
			columncounter = 0;
		}
	}
	out.println("</table>");
	out.println("<br>"); %>
</body>
</html>